#ifndef CODECOMPLETER_H
#define CODECOMPLETER_H

#include <QListWidget>
#include "texteditor.h"


QT_BEGIN_NAMESPACE
	class QKeyEvent;
QT_END_NAMESPACE;

/**
  * Class to enable autocompletion of words in the current document.
  */
class AutoCompletion : public QListWidget
{
	Q_OBJECT

	private:
		TextEditor *editor;
		Qt::CaseSensitivity caseSensitivity;
		bool shortcutPressed;

	public:
		const static int MAX_WIDTH;
		const static int MAX_HEIGHT;

		explicit AutoCompletion(TextEditor *newEditor = NULL);

		void processKeyEvent(QKeyEvent *event) { keyPressEvent(event); }
		void updateCompletions();
		void setCaseSensitive(const Qt::CaseSensitivity sensitive) { caseSensitivity = sensitive; }
		Qt::CaseSensitivity getCaseSensitivity() const { return caseSensitivity; }

	public slots:
		void movePopup();

	protected:
		void keyPressEvent(QKeyEvent *event);
};

#endif // CODECOMPLETER_H
